#include <bits/stdc++.h> 
using namespace std;
using ll=long long;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);

    int n;
    cin >> n;
    vector<int> a(n + 1, 0);

    for (int i = 0; i < n - 1; ++i) {
        int u, v;
        cin >> u >> v;
        a[u]++;
        a[v]++;
    }

    ll res = 0;
    for (int i = 1; i <= n; ++i) {
        ll d = a[i];
        res += d * (d - 1) / 2;
    }

    cout << res << endl;

    return 0;
}
